package com.example.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.example.pojo.Adjustprice;
import com.example.pojo.Materialzhu;
import com.example.pojo.Warehouse;
import com.example.service.AdjustBiz;
import com.example.service.publi;
import com.example.vo.zyz.pageBean;

@Controller
@RequestMapping("/msq")
public class AdjustAction {
	
	@Autowired
	private AdjustBiz abiz;
	@Autowired
	publi action;
	
	//主详查询
	@RequestMapping("/msqfindAll")
	@ResponseBody
	public pageBean query(Integer pagesize){
		return abiz.findAll(pagesize);
	}
	//主祥新增
	@RequestMapping(value="/msqadd",method=RequestMethod.POST)
	@ResponseBody
	public void addOrModify(@RequestBody Adjustprice ap){
//		Adjustinfo info = new Adjustinfo("1", 12.1, 123.1, "hhh", "2017051901");
//		List<Adjustinfo> data = new ArrayList<Adjustinfo>();
//		data.add(info);
//		Adjustprice ap = new Adjustprice("2017051901",new Date(),"人民币","人民币","123456","调单价","哈哈","哈哈","1","hh",123.12,"fdklafksdh",data);
		abiz.addorModify(ap);
	}
	
	//修改是否审核
	@RequestMapping(value="/msqupdate")
	@ResponseBody
	public void update(String id){
		abiz.updateState(id);
	}
	//物理删除
	@RequestMapping(value="/msqremove")
	@ResponseBody
	public void remove(String id){
		abiz.remove(id);
	}
	
	@RequestMapping(value="/danhao")
	@ResponseBody
	public String danhao(String dangqiandate,String biaming,String lie){
		return action.danhao(dangqiandate, biaming, lie);
	}
	
	@RequestMapping(value="/queryware")
	@ResponseBody
	public Warehouse queryware(String id){
		return abiz.queryware(id);
	}
	
	@RequestMapping(value="/querymaterial")
	@ResponseBody
	public Materialzhu querymaterial(String id){
		return abiz.querymatter(id);
	}
	
	@RequestMapping(value="/examine")
	@ResponseBody
	public void examine(double price,String proid,Integer num){
//		System.out.println("price="+price+",proid="+price+",num="+num);
		abiz.examine(price, proid, num);
	}
}
